<?php

/**
 * Plantilla filter form base class.
 *
 * @package    sms
 * @subpackage filter
 * @author     Patricio Andrés Córdova De La Cruz
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasePlantillaFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nombre_plantilla' => new sfWidgetFormFilterInput(),
      'texto'            => new sfWidgetFormFilterInput(),
      'id_tipo'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TipoPlantilla'), 'add_empty' => true)),
      'estado'           => new sfWidgetFormFilterInput(),
      'masivo'           => new sfWidgetFormFilterInput(),
      'dias'             => new sfWidgetFormFilterInput(),
      'hora_inicial'     => new sfWidgetFormFilterInput(),
      'hora_final'       => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'nombre_plantilla' => new sfValidatorPass(array('required' => false)),
      'texto'            => new sfValidatorPass(array('required' => false)),
      'id_tipo'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TipoPlantilla'), 'column' => 'id_tipo')),
      'estado'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'masivo'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'dias'             => new sfValidatorPass(array('required' => false)),
      'hora_inicial'     => new sfValidatorPass(array('required' => false)),
      'hora_final'       => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('plantilla_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Plantilla';
  }

  public function getFields()
  {
    return array(
      'id_plantilla'     => 'Number',
      'nombre_plantilla' => 'Text',
      'texto'            => 'Text',
      'id_tipo'          => 'ForeignKey',
      'estado'           => 'Number',
      'masivo'           => 'Number',
      'dias'             => 'Text',
      'hora_inicial'     => 'Text',
      'hora_final'       => 'Text',
    );
  }
}
